<?php
/**
 * +----------------------------------------------------------------------
 * | Author: 罗极
 * +----------------------------------------------------------------------
 * | Description: Halt.php
 * +----------------------------------------------------------------------
 * | User: Administrator Date: 8/21/ 0021 Time: 14:34
 * +----------------------------------------------------------------------
 */

namespace Framework\App;

use Framework\Config\Constant\DefaultKey;
use Framework\Config\Config;

class Halt
{
    public static function shutdown()
    {

        $configObj = Config::getInstance();
        if($configObj->get(DefaultKey::Debug)) {
            $error = error_get_last();
            if(!empty($error)) {
                $type       = $error['type'];
                $message    = $error['message'];
                $file       = $error['file'];
                $line       = $error['line'];
                $p = "<p>%s</p>";
                echo sprintf($p, '错误类型: '. $type);
                echo sprintf($p, '错误信息: '. nl2br($message));
                echo sprintf($p, '错误文件: '. $file);
                echo sprintf($p, '错误行号: '. $line);
            }
        }
        echo '<br />框架执行结束!(todo del)';
    }
}